<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>第一题</title>
</head>

<body>
    <script>
        // 小王的对象
        // 拷贝
        // [{'小智慧': 18},{'小王':28},{'小绿':28}]
        // 年龄累加
        function gethanshu() {
            let arr = {
                status: 200,
                data: [
                    { uname: '小智慧', age: 18 },
                    { uname: '小王', age: 28 },
                    { uname: '小绿', age: 28 },]
            }
            const arr1 = JSON.parse(JSON.stringify(arr))
            console.log(arr1)
            let { status, data, data: [a, b, c] } = arr
            console.log(b)
            let arr2 = []
            data.map(item => {
                arr2.push({ uname: item.uname })
            })
            console.log(arr2)
            const sum = data.reduce((prve, item) => {
                return prve += item.age
            }, 0)
            console.log(`年龄和为：${sum}`)
        }
        gethanshu()
    </script>
</body>

</html>